MyModules.define('image',[],function(){
	class Child extends WidgetObject {
	    constructor() {
	        super(); // 调用父类构造函数
	        // 子类可以添加自己的属性或方法
	        this.name = '單圖';
		    this.datas.name = this.name;
		    this.getHtml = function () {
				if(this.datas.value['content']){
					return '<img class="wrap-widget imageWidget" src="'+formatUrl(this.datas.value['content'])+'" data-id="'+this.datas.id+'"  data-original-title="'+this.datas.name+'" data-toggle="tooltip"/>';
				}
				return '<img class="wrap-widget imageWidget" data-id="'+this.datas.id+'"  data-original-title="'+this.datas.name+'" data-toggle="tooltip"/>'
			};
			this.inputTemplate = function(id, value){
				var url = buildUrl(urlInfo.upload.iframe,{
					type:0,
					relative_url:1,
					akey:apkey,
					field_id:'input-'+this.datas.id,
				});
	            var str = '<div class="form-group "><div class="input-group"><input class="form-control" name="content" value="'+(this.datas.value['content'] ? this.datas.value['content'] : '')+'" id="input-'+this.datas.id+'"><div class="input-group-btn"><a href="'+url+'" class="btn btn-primary btn-rf-image" img-fancybox data-id="input-'+this.datas.id+'">選擇圖片</a></div></div></div>';
	            return str;
	        };
	    }
	}
	return new Child();
});
